/*
 * UnPrizeDialog.java
 * business
 *
 * Created by ChenTao on 2017/2/25.
 *
 * Copyright (c) 2017年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.widget.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.yidiandao.business.R;
import com.yidiandao.business.utils.ImageLoader;
import com.yidiandao.business.utils.UIUtils;

/** 未中奖的Dialog */
public class UnPrizeDialog extends Dialog {

    private TextView mTvConfirm;
    private TextView mTvTip;
    private ImageView mIvPic;

    public UnPrizeDialog(Context context) {
        super(context, R.style.ThemeNoTitleDialog);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.dialog_un_prize);
        mTvConfirm = (TextView) findViewById(R.id.tv_confirm);
        mTvTip = (TextView) findViewById(R.id.tv_tip);
        mIvPic = (ImageView) findViewById(R.id.iv_pic);

        mTvConfirm.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dismiss();
                    }
                });
    }

    /**
     * @param drawCount 剩余抽奖次数
     * @param path 图片路径
     */
    public void setCount(int drawCount, String path) {
        mTvTip.setText(
                drawCount == 0
                        ? UIUtils.getString(R.string.do_it_tomorrow)
                        : UIUtils.getString(R.string.do_it_next));
        ImageLoader.loadImageFitXY(UIUtils.getContext(), mIvPic, path);
    }
}
